﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>登录</title>
    <!--<link href="css/themes/default/jquery.mobile-1.4.5.min.css" rel="stylesheet" type="text/css" />
    <link href="css/themes/classic/theme-classic.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.mobile-1.4.5.min.js" type="text/javascript"></script>-->
    <link href="../CCMobile/js/mui/css/mui.min.css" rel="stylesheet" type="text/css" />
    <link href="../CCMobile/js/mui/css/style.css" rel="stylesheet" type="text/css" />
    <script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../CCMobile/js/mui/js/mui.min.js" type="text/javascript"></script>
    <script src="../CCMobile/js/jquery.min.js" type="text/javascript"></script>
    <script src="../CCMobile/js/jquery.js" type="text/javascript"></script>
    <script src="../CCMobile/Scripts/config.js" type="text/javascript"></script>
    <script src="../CCMobile/Comm/Gener.js" type="text/javascript"></script>
    <script src="../Portal/Standard/js/crypto-js.min.js"></script>
    <script src="../Portal/Standard/js/aes.js"></script>
    <script type="text/javascript">

        var orgNo = null;
        //页面启动函数.
        $(function () {

            orgNo = GetQueryString("OrgNo");

            InitPage();
        });

        function InitPage() {

            var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("Login_Init");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }
            if (data.indexOf('url@') == 0) {
                var data = data.replace('url@', '');
                SetHref(data);
                //  SetHref( "Apps.htm";
                return;
            }
            data = JSON.parse(data);

            var userNo = data.UserNo;
            var html = "";

            if (userNo.length == 0) {

                html += "<div class=\"user-head-icon\" style=\"background-image: url(../DataUser/UserIcon/Default.png)\">";
                html += "</div>";
                html += "<p class=\"data-ucname\" style=\"font-weight: normal;\">";
                html += "欢迎登录</p>";

            } else {

                html += "<div class=\"user-head-icon\" style=\"background-image: url(../DataUser/UserIcon/" + data.UserNo + "Biger.png)\">";
                html += "</div>";
                html += "<p class=\"data-ucname\">";
                html += data.UserName;
                html += "</p>";
                document.getElementById("TB_No").value = userNo;
            }
            $("#header").append(html);
            $("#footer h5").html("&copy " + data.CustomerName);
        }
    </script>
    <style>
        body {
            background: #fff;
        }

        .mui-content, .mui-input-group:before, .mui-input-group:after {
            background: #fff;
        }

        .mui-logo {
            margin-top: 15%;
            margin-bottom: 15%;
            text-align: center
        }

            .mui-logo span {
                display: block
            }

            .mui-logo img {
                width: 100%;
            }

        .mui-input-row {
            margin: 10px 10px 20px;
        }

            .mui-input-row label {
                width: 20% !important;
                color: #808080;
                font-size: 13px;
            }

                .mui-input-row label ~ input {
                    width: 80% !important
                }

        .mui-input-group .mui-input-row:after {
            left: 0px;
        }

        .mui-btn-sm {
            padding: 10px 0px;
        }
    </style>
</head>
<body>

    <div class="mui-content">
        <div class="mui-logo">
            <img src="../DataUser/ICON/logoFrm.png" />
        </div>
        <form id='login-form' class="mui-input-group">
            <div class="mui-input-row">
                <label>
                    账号
                </label>
                <input name="TB_No" id="TB_No" type="text" class="mui-input-clear mui-input" placeholder="请输入账号" />
                <div id="errMsg"> </div>

            </div>
            <div class="mui-input-row">
                <label>
                    密码
                </label>
                <input name="TB_PW" id="TB_PW" type="password" class="mui-input-clear mui-input"
                       placeholder="请输入密码" />
            </div>
        </form>
        <div class="mui-content-padded">
            <button onclick="Login()" type="button" data-loading-icon="mui-spinner mui-spinner-custom"
                    class="mui-btn mui-btn-sm mui-btn-block mui-btn-primary">
                登录
            </button>
            <div id="Msg"></div>
        </div>
        <div class="mui-content-padded oauth-area">
        </div>
    </div>
    <script src="../CCMobile/js/mui/js/mui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        //执行后台登录.
        function Login() {

            $("#Msg").html("<font> 正在登录,请稍候... </font>");

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Portal");

            var userNo = $("#TB_No").val();
            var pass = $("#TB_PW").val();

            if (userNo == "" || pass == "") {
                $("#Msg").html("<font color=red>请输入用户名，密码.</font>");
                return;
            }

            handler.AddPara("TB_No", userNo);
            handler.AddPara("TB_PW",  encrypt(pass));

            var data = handler.DoMethodReturnString("Login_Submit");
            if (data.indexOf('err@') == 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                // $("#validate").show();
                // createCode();
                return;
            }

            if (data.indexOf('url@') == 0) {
                var data = data.replace('url@', '');
                SetHref(data);
                //  SetHref( "Apps.htm";
                return;
            }

            alert(data);
        }

    </script>
</body>
</html>
